import React from 'react';
import Tooltip, { TooltipProps } from './Tooltip';

export default function Texty(props: Omit<TooltipProps, 'showTooltipFn'>): React.ReactNode {
  if (!props.children) {
    return null;
  }
  return (
    <Tooltip
      data-qtrade-texty
      showTooltipFn={(target) => !!target && target.scrollWidth > target.offsetWidth}
      {...props}
    />
  );
}
